'''
Created on 03/05/2010

@author: Val
'''
import re

class Reader(object):
    '''
    classdocs
    '''


    def __init__(self, file):
        '''
        Constructor
        '''
        self.values = {}
        o_file = open(file, 'r')
        for line in o_file:
            value = line.encode().split()
            self.values[value[0]] = value[1]
    def ask_value(self):
        '''
        '''
        total = 0
        good = 0
        wrong = 0
        sp_info = []
        fr_info = []
        for sp,fr in self.values.iteritems():
            sp_info.append(sp)
            fr_info.append(fr)
        
        while len(sp_info) > 0:
            print 'Size now is = ' + str(len(sp_info))
            toremove = []
            for loc in range(len(sp_info)):
                print 'French word for spanish = ' + sp_info[loc]
                fr_test = raw_input("")
                print 'Good = ' + fr_info[loc] + ' Yours = ' + fr_test
                total += 1
                if fr_info[loc] == fr_test:
                    print 'OK!'
                    good += 1
                    toremove.append(loc)
                else:
                    print 'Failure...'
                    wrong += 1
            print 'Assign'
            toremove.reverse()
            for item in toremove:
                sp_info.remove(sp_info[item])
                fr_info.remove(fr_info[item])
        
            print 'Total values = ' + str(total) + ' good values = ' + str(good) + \
                ' wrong values = ' + str(wrong)